import java.util.Scanner;

//题目：取一个整数a从右端开始的4～7位。
public class Test32 {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        long a = console.nextLong();
        long[] arr = math(a);
        System.out.print("整数" + a + "从右端开始的4-7位为：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static long[] math(long a) {
        long[] arr = new long[4];
        if (a > 9999999) {
            a = a % 10000000;
            arr = mathy(a);
            return arr;
        } else {
            arr = mathy(a);
            return arr;
        }
    }

    public static long[] mathy(long a) {
        long[] arr = new long[4];
        int b = 1000000;
        for (int i = 0; i < 4; i++) {
            arr[3 - i] = a / b;//第七位开始
            a = a % b;
            b /= 10;
        }
        return arr;
    }
}
